"pfilter"(object, params, Np, tol = 1e-17, max.fail = Inf, pred.mean = FALSE, pred.var = FALSE, filter.mean = FALSE, filter.traj = FALSE, save.states = FALSE, save.params = FALSE, verbose = getOption("verbose"), ...)
"pfilter"(object, params, Np, tol, ...)
"logLik"(object, ...)
"cond.logLik"(object, ...)
"eff.sample.size"(object, ...)
"pred.mean"(object, pars, ...)
"pred.var"(object, pars, ...)
"filter.mean"(object, pars, ...)
"filter.traj"(object, vars, ...)
pomp
or inheriting class pomp
.
params = coef(object)
.
Np
either as a vector of positive integers of length length(time(object,t0=TRUE))or as a function taking a positive integer argument. In the latter case,
Np(k)
must be a single positive integer, representing the number of particles to be used at the k
-th timestep:
Np(0)
is the number of particles to use going from timezero(object)
to time(object)[1]
,
Np(1)
, from timezero(object)
to time(object)[1]
,
and so on, while when T=length(time(object,t0=TRUE))
,
Np(T)
is the number of particles to sample at the end of the time-series.
When object
is of class mif
, this is by default the same number of particles used in the mif
iterations.
tol
are considered to be incompatible with the data.
See the section on Filtering Failures below for more information.
max.fail
is set to infinity, so no error can be triggered.
TRUE
, the prediction means are calculated for the state variables and parameters.
TRUE
, the prediction variances are calculated for the state variables and parameters.
TRUE
, the filtering means are calculated for the state variables and parameters.
TRUE
, a filtered trajectory is returned for the state variables and parameters.
save.states=TRUE
, the state-vector for each particle at each time is saved in the saved.states
slot of the returned pfilterd.pomp
object.
If save.params=TRUE
, the parameter-vector for each particle at each time is saved in the saved.params
slot of the returned pfilterd.pomp
object.
TRUE
, progress information is reported as pfilter
works.
pfilterd.pomp
.
This class inherits from class pomp
.
The following additional slots can be accessed via the $
operator:
Np
particles is compatible with the data.
In particular, if the conditional likelihood of a particle at any time is below the tolerance value tol
, then that particle is considered to be uninformative and its likelihood is taken to be zero.
A filtering failure occurs when this is the case for all particles.
A warning is generated when this occurs unless the cumulative number of failures exceeds max.fail
, in which case an error is generated.pomp
, mif
, pmcmc
, bsmc2
,
and the tutorials on the package website.
pompExample(gompertz)
pf <- pfilter(gompertz,Np=1000) ## use 1000 particles
plot(pf)
logLik(pf)
cond.logLik(pf) ## conditional log-likelihoods
eff.sample.size(pf) ## effective sample size
logLik(pfilter(pf)) ## run it again with 1000 particles
## run it again with 2000 particles
pf <- pfilter(pf,Np=2000,filter.mean=TRUE)
fm <- filter.mean(pf) ## extract the filtering means
Run the code above in your browser using DataLab